import random
import md5

ignore = """\
sehjghjdshgohngohn
ftdsgjhngshjgosidg
gjedshgjhdsgjhdghf
angiaijfiosdjgpjdg
gsjgsgdjjogssdgjpp
gjfdjfgkjfkoofjdhp
gjfoggagjdfjkjolhh
gjijfgjtgnjhjghjkh"""

class Encrypter(object):
    def __init__(self):
        """ Create a challenge for the MD5 hash """
        self.randomNumber = random.randint(1, 12)
        self.word = ""
        for lineNumber, line in enumerate(ignore.split("\n")):
            self.word += line[lineNumber]
        self.word = self.encryptWord(self.word)
        
    def md5(self, string):
        m = md5.new()
        m.update(self.word)
        m.update(string)
        return m.hexdigest() + "%02d" % self.randomNumber
        
    def encryptWord(self, string):
        return "".join([chr(ord(x) - self.randomNumber) for x in string])
        
    def decryptWord(self, string):
        return "".join([chr(ord(x) - self.randomNumber) for x in string])